package org.emavaj.common;

import org.emavaj.sanguosha.model.exception.SGSException;

/**
 * 
 * @author eMavaj
 * 
 */
public class ReflectUtil {

	public static <E> Object getClassInstance(Class<E> clazz)
			throws InstantiationException, IllegalAccessException {
		return clazz.newInstance();
	}

	public static Object getClassInstance(String fullname)
			throws ClassNotFoundException, InstantiationException,
			IllegalAccessException {
		Class<?> newClass = Class.forName(fullname);
		if (newClass != null) {
			return newClass.newInstance();
		} else {
			throw new SGSException("class for name get error");
		}
	}
}
